﻿using Autofac;
using MintCyclingService.alipay;
using MintCyclingService.Utils;
using MintCyclingService.WeixinApliay;
using MintCyclingWebApi.Filter;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;

namespace MintCyclingWebApi.AppControllers
{
    [RequestCheck]
    public class WeiXinPayController : ApiController
    {
        //微信支付数据访问接口类
        IWeixinAlipayTradeService _WeiPayService;


        /// <summary>
        /// 初始化微信支付控制器
        /// </summary>
        public WeiXinPayController()
        {
            _WeiPayService = AutoFacConfig.Container.Resolve<IWeixinAlipayTradeService>();

        }


        /// <summary>
        /// 商户发起生成预付单请求  complete TOM
        /// DATE:2017-04-24
        /// </summary>
        /// <returns>类别：TypeName =1表示押金充值；TypeName=2表示余额充值</returns>
        [HttpPost]
        public ResultModel GetWeiXinTradeAppPay([FromBody]WeixinAlipayTradeModel para)
        {
            return _WeiPayService.GetWeiXinTradeAppPay(para);
        }


        /// <summary>
        /// 查询押金充值是否成功  complete TOM
        /// DATE:2017-04-25
        /// <param name="para">充值的类别1：支付宝充值押金；2：微信充值押金</param>
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public ResultModel GetRechargeStatusByUserInfoGuid([FromBody]WeixinIsSuccessOrFail para)
        {
            return _WeiPayService.GetRechargeStatusByUserInfoGuid(para);
        }

        /// <summary>
        /// 用户退押金接口 ccomplete tanhui[暂时废弃]
        /// 2017年4月27日
        /// </summary>
        /// <param name="para"></param>
        /// <returns></returns>
        [HttpPost]
        public ResultModel DepositAlipayTradeRefund([FromBody]UserDepositRefundModel para)
        {
            return _WeiPayService.WeixinRefund(para);
        }


    }
}